package com.hnust.dao;

import com.hnust.domain.QuestionType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 题目类型接口
 * @author 小游
 * @date 2020/10/30
 */
@Mapper
@Repository
public interface QuestionTypeDao {

    /**
     *  获取所有的题型
     * @return 返回所有的题型信息
     */
    @Select("select * from question_type")
    @ResultType(QuestionType.class)
    List<QuestionType> getAllQuestionType();

    /*
     * @Author Tonited
     * @Description //TODO 根据题目类型号获取题目类型id
     * @Date 9:40 2020/10/31
     * @Param [queTyp]
     * @return java.lang.String
     **/
    @Select("select que_typ_id from question_type where type=#{queTyp}")
    @ResultType(String.class)
    String getQeuTypIdByQueTyp(Integer queTyp);

    /*
     * @Author Tonited
     * @Description //TODO 根据题目类型id获取题目类型名
     * @Date 9:40 2020/10/31
     * @Param [queTyp]
     * @return java.lang.String
     **/
    @Select("select name from question_type where que_typ_id=#{queTypId}")
    @ResultType(String.class)
    String getQeuTypeNameByQueTypId(String queTypId);
}
